import 'dart:ui';

import 'package:easy_refresh/easy_refresh.dart';
import 'package:flutter/material.dart';
import 'package:flutter_chat/common/widget/easy_refresh/custom_classic.dart';
import 'package:flutter_chat/pages/application/pages/user/logic.dart';
import 'package:get/get.dart';
import 'package:get/get_state_manager/src/simple/get_view.dart';

class FindState {
  // ignore: empty_constructor_bodies
  FindState() {}
}

class FindLogic extends GetxController {
  final FindState findstate = FindState();
}

// ignore: camel_case_types
class FindPage extends GetView<UserLogic> {
  const FindPage({super.key});

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Column(
      children: [
        Container(
          color: Colors.blue,
          child: BackdropFilter(
            filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5),
            child: Container(
              width: 200,
              height: 40,
              alignment: Alignment.center,
              decoration: const BoxDecoration(
                  color: Colors.transparent,
                  borderRadius: BorderRadius.all(Radius.circular(6))),
              child: const Text("222"),
            ),
          ),
        ),
        Expanded(child: _buildEasyRefresh())
      ],
    );
  }

  EasyRefresh _buildEasyRefresh() {
    return EasyRefresh.builder(
        header: CustomClassic().getHeader(),
        footer: CustomClassic().getFooter(),
        onRefresh: () async {
          await Future.delayed(const Duration(seconds: 2));
        },
        onLoad: () async {
          await Future.delayed(const Duration(seconds: 2));
        },
        childBuilder: (context, physisc) {
          return _buildList(physisc);
        });
  }

  ListView _buildList(ScrollPhysics physics) {
    return ListView.builder(
      physics: physics,
      itemBuilder: (context, index) {
        return ListTile(
          title: Text("sss${index},${gloabcolors[index]}"),
          subtitle: Text("SSS"),
        );
      },
      itemCount: gloabcolors.length,
    );
  }
}

final List<Color> gloabcolors = <Color>[
  Colors.black,
  Colors.white,
];
